import tkinter as tk
import random
def jf():
    n=int(text01.get())
    listbox01.delete(0,"end")
    i=1
    while i<=n:
        a=random.randint(0,100)
        b=random.randint(0,100)
        if a+b<100:
            listbox01.insert(tk.END,"("+str(i)+")"+str(a)+"+"+str(b)+"=")
            i=i+1
win = tk.Tk()
win.title('加法练习生成器')
win.geometry('560x320')

#阻止Python GUI的大小调整-+
win.resizable(0, 0)

#建组件
lb01 = tk.Label(win, text='题数:')
text01 = tk.Entry(win)
listbox01 = tk.Listbox(win)
btn = tk.Button(win, text='生成', command=jf)

#布局
lb01.place(x=30, y=25)
text01.place(x=70, y=25, width=50, height=50)
listbox01.place(x=200, y=25)
listbox01.place(x=200, y=25, width=300, height=200)
btn.place(x=70, y=200, width=70, height=50)

#接收窗体事件
win.mainloop()
